#!/bin/bash
KAFKA_HOME=/disk2/kafka_2.10-0.8.2.2
while true; do
        # for raw-binary input
        changkong_processed_offset=$(echo "get /consumers/fc-group/offsets/gw-field-control/0" | $KAFKA_HOME/bin/zookeeper-shell.sh 10.1.235.1,10.1.235.2,10.1.235.15,10.1.235.15,10.1.235.16,10.1.235.17 2>/dev/null | tail -n 1)
        echo "put goldwind.kafka.changkong.offset.processed $(date +%s) $avro_processed_offset host=$(hostname -s)"
        changkong_latest_offset=$($KAFKA_HOME/bin/kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list 10.1.235.5:9092,10.1.235.6:9092,10.1.235.10:9092,10.1.235.11:9092 --time -1 --topic gw-field-control | grep :0: | awk -F [:] '{print $3}')
        echo "put goldwind.kafka.changkong.offset.latest $(date +%s) $changkong_latest_offset host=$(hostname -s)"
done

